package com.ruoyi.common.core.enums;

/**
 * @Description: 是否
 */
public enum CBECYesNoEnum {

    YES(0, "Y", "是"),
    NO(1,"N", "否");

    private final Integer code;
    private final String codeEn;
    private final String name;

    CBECYesNoEnum(Integer code, String codeEn, String name) {
        this.code = code;
        this.codeEn = codeEn;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getCodeEn() {
        return codeEn;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(Integer code) {
        for (CBECYesNoEnum c : CBECYesNoEnum.values()) {
            if (c.getCode().equals(code)) {
                return c.getName();
            }
        }
        return null;
    }

    public static String getCodeEnByCode(Integer code) {
        for (CBECYesNoEnum c : CBECYesNoEnum.values()) {
            if (c.getCode().equals(code)) {
                return c.getCodeEn();
            }
        }
        return null;
    }

    public static Integer getCodeByName(String name) {
        for (CBECYesNoEnum c : CBECYesNoEnum.values()) {
            if (c.getName().equals(name)) {
                return c.getCode();
            }
        }
        return null;
    }

    public static String getNameByCodeEn(String codeEn) {
        for (CBECYesNoEnum c : CBECYesNoEnum.values()) {
            if (c.getCodeEn().equals(codeEn)) {
                return c.getName();
            }
        }
        return null;
    }

    public static String getCodeEnByName(String name) {
        for (CBECYesNoEnum c : CBECYesNoEnum.values()) {
            if (c.getName().equals(name)) {
                return c.getCodeEn();
            }
        }
        return null;
    }

    public static Integer getCodeByCodeEn(String codeEn) {
        for (CBECYesNoEnum c : CBECYesNoEnum.values()) {
            if (c.getCodeEn().equals(codeEn)) {
                return c.getCode();
            }
        }
        return null;
    }

}
